package testpackage;

import java.util.ArrayList;

public class Family {
	//This class models the family. Every family is made up of persons.
	//It is possible to add new members to the family
	
	
	//Instance Variables
	private Person mother;
	private Person father;
	private ArrayList children;
	
	
	//Constructor
	public Family (Person mom, Person dad) {
		
		this.mother = mom;
		this.father = dad;
		this.children = new ArrayList();
	}
	
	public void addChild (Person aChild) {
		//add a child to the children array of the family
		
		this.children.add(aChild);
	}
	
	public void listFamilyMembers() {
		//prints out the family members names
		
		Person oneChild;
		
		System.out.println("The members of the family are: ");
		System.out.print("The mother: " );
		this.mother.display();
		System.out.print("The father: " );
		this.father.display();
		
		if (this.children.size() < 1)
			System.out.println("They have no children.");
		else {
			System.out.println("They have " + this.children.size() + " children. They are: ");
			for (int i = 0 ; i < children.size() ; i++) {
				oneChild = (Person) this.children.get(i);
				oneChild.display();
			}
		}
		
	}
	

}
